/*
 * Copyright (c) 2014-2020 杭州派迩信息技术有限公司 All Rights Reserved.
 * ProjectName: pi-flowable-project
 * ModuleName: pi-actuator-service
 * FileName: PiActuatorProjectController.java
 * Author: kai.li
 * Date: 2021/08/31 18:16:31
 * Version: 1.0
 * LastModified: 2021/08/31 18:16:31
 */

package com.pisolution.actuator.service.controller;

import com.pisolution.actuator.service.model.ActionResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.pisolution.actuator.service.model.PiActuatorProject;
import com.pisolution.actuator.service.service.PiActuatorProjectService;

/**
 * @className: PiActuatorProjectController
 * @description: 前端控制器
 * @author: kai.li
 * @date: 2021/08/31 18:16:31
 * @since: 1.0
 */

@RestController
@RequestMapping("/pi-actuator-service")
public class PiActuatorProjectController {

    @Autowired
    private PiActuatorProjectService piActuatorProjectService;

    @PostMapping(value = "/addProject")
    public ActionResult<String> addProject(@RequestBody PiActuatorProject piActuatorProject){
        ActionResult result = new ActionResult();
        Boolean addResult = piActuatorProjectService.addProject(piActuatorProject);
        if(addResult){
            result.setCode(0);
            result.setMsg("success");
        }else{
            result.setCode(-1);
            result.setMsg("failed");
        }
        return result;
    }
}
